﻿using ENMAX_ArcGIS;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Windows;
using System.Windows.Markup;
using Microsoft.Surface.Presentation;
using ESRI.ArcGIS.Client.Geometry;

namespace ENMAX_ArcGIS_TestProject
{
    
    
    /// <summary>
    ///This is a test class for TroubleTicketListFrameTest and is intended
    ///to contain all TroubleTicketListFrameTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TroubleTicketListFrameTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for RemoveTroubleTicket
        ///</summary>
        [TestMethod()]
        public void RemoveTroubleTicketTest()
        {
            TwoPointScatterView tpScatterView = new TwoPointScatterView(); 
            Point pt = new Point(100, 100); 
            double orientation = 0; 
            TroubleTicketListFrame target = new TroubleTicketListFrame(tpScatterView, pt, orientation);
            TroubleTicket tTicket1 = new TroubleTicket(new MapPoint(), "ticket1", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            TroubleTicket tTicket2 = new TroubleTicket(new MapPoint(), "ticket2", "0006789", TroubleTicket.TroubleTicketSeverity.High);

            TroubleTicketListItem item1 = target.AddTroubleTicket(tTicket1);
            TroubleTicketListItem item2 = target.AddTroubleTicket(tTicket2);
            target.RemoveTroubleTicketItem(item1);
            Assert.IsFalse(target.TroubleTicketListItems.Contains(item1), "Did not remove TroubleTicket correctly");
            Assert.IsTrue(target.TroubleTicketListItems.Contains(item2), "Removed TroubleTicket incorrectly");
        }

        /// <summary>
        ///A test for AddTroubleTicket
        ///</summary>
        [TestMethod()]
        public void AddTroubleTicketTest()
        {
            TwoPointScatterView tpScatterView = new TwoPointScatterView();
            Point pt = new Point(100, 100);
            double orientation = 0;
            TroubleTicketListFrame target = new TroubleTicketListFrame(tpScatterView, pt, orientation);
            TroubleTicket tTicket1 = new TroubleTicket(new MapPoint(), "ticket1", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            TroubleTicket tTicket2 = new TroubleTicket(new MapPoint(), "ticket2", "0006789", TroubleTicket.TroubleTicketSeverity.High);
            TroubleTicketListItem item1 = new TroubleTicketListItem(tTicket1);
            TroubleTicketListItem item2 = new TroubleTicketListItem(tTicket2);
            target.AddTroubleTicket(item1);
            Assert.IsTrue(target.TroubleTicketListItems.Contains(item1), "Did not add TroubleTicket correctly");
            target.AddTroubleTicket(item2);
            Assert.IsTrue(target.TroubleTicketListItems.Contains(item2), "Did not add TroubleTicket correctly");
        }
    }
}
